package com.entity;


import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

import java.io.FileOutputStream;
import java.io.IOException;

/**
 * Excel写入数据
 */

public class Demo {
    public static void main(String[] args) throws IOException {
        //指定位置创建工作薄
        FileOutputStream out = new FileOutputStream("G:\\Excel练习\\信息.xls");
        //03版 创建工作薄   //07版  XSSFWorkbook workbook = new XSSWorkbook()
        HSSFWorkbook workbook = new HSSFWorkbook();
        //创建sheet页
        HSSFSheet kf13 = workbook.createSheet("kf13");
        //创建行 下标从0开始
        HSSFRow row = kf13.createRow(0);
        //创建单元格 下标从0开始
        HSSFCell cell = row.createCell(5);
        //写入内容
        cell.setCellValue("你忘了我以前是卖鱼的?");
        workbook.write(out);
        out.close();
    }
}
